package com.sun.core.util;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import sun.core.json.JSONObject;

@SuppressWarnings("serial")
public class TestServlet extends HttpServlet {
	@Override
	@SuppressWarnings("unchecked")
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("text/html");
		PrintWriter out = response.getWriter();
		try {
			String strJSON = null;
			JSONObject myObject = null;
			if (request.getParameter("myObject") != null) {
				strJSON = request.getParameter("myObject");
				JSONObject json = new JSONObject();
				json.put("statusCode", 200);
				String value1 = "asdf";
				String value2 = "asdf";
				json.put("message", value1 + value2);
				json.put("navTabId", "");
				json.put("rel", "");
				json.put("callbackType", "closeCurrent");
				json.put("forwardUrl", "");
				System.out.println(json.toString());
				out.print(json.toString());
				

			} else {
			}
		} finally {
			out.flush();
			out.close();
		}

	}

	@Override
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response);
	}
}
